<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.2">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/icon.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/icon.png">
  <link rel="mask-icon" href="/blog/images/icon.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">


<link rel="stylesheet" href="/blog/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"bgape002.gitee.io","root":"/blog/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="linux常用命令ls显示文件信息。 1234ls -a &#x2F;  # 显示根目录下所有文件ls -l &#x2F;  # 显示根目录下文件详细信息ls -lh &#x2F; # 显示根目录的详细信息ls -i &#x2F;  # 显示根目录下文件的标识号">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux常见命令">
<meta property="og:url" content="https://bgape002.gitee.io/2021/07/05/linux%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4/index.html">
<meta property="og:site_name" content="bgape002">
<meta property="og:description" content="linux常用命令ls显示文件信息。 1234ls -a &#x2F;  # 显示根目录下所有文件ls -l &#x2F;  # 显示根目录下文件详细信息ls -lh &#x2F; # 显示根目录的详细信息ls -i &#x2F;  # 显示根目录下文件的标识号">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-07-05T11:59:09.000Z">
<meta property="article:modified_time" content="2022-01-27T03:09:21.818Z">
<meta property="article:author" content="bgape002">
<meta property="article:tag" content="linux基础">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://bgape002.gitee.io/2021/07/05/linux%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Linux常见命令 | bgape002</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/blog/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">bgape002</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">淡泊明志，宁静致远</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/blog/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">66</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">27</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">61</span></a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://bgape002.gitee.io/2021/07/05/linux%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/head.png">
      <meta itemprop="name" content="bgape002">
      <meta itemprop="description" content="mail: bgape002@163.com">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="bgape002">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Linux常见命令
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-07-05 19:59:09" itemprop="dateCreated datePublished" datetime="2021-07-05T19:59:09+08:00">2021-07-05</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2022-01-27 11:09:21" itemprop="dateModified" datetime="2022-01-27T11:09:21+08:00">2022-01-27</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/blog/2021/07/05/linux%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/blog/2021/07/05/linux%E5%9F%BA%E7%A1%80%E5%91%BD%E4%BB%A4/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="linux常用命令"><a href="#linux常用命令" class="headerlink" title="linux常用命令"></a>linux常用命令</h2><h3 id="ls"><a href="#ls" class="headerlink" title="ls"></a>ls</h3><p>显示文件信息。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">ls</span> -a /  <span class="comment"># 显示根目录下所有文件</span></span><br><span class="line"><span class="built_in">ls</span> -l /  <span class="comment"># 显示根目录下文件详细信息</span></span><br><span class="line"><span class="built_in">ls</span> -lh / <span class="comment"># 显示根目录的详细信息</span></span><br><span class="line"><span class="built_in">ls</span> -i /  <span class="comment"># 显示根目录下文件的标识号</span></span><br></pre></td></tr></table></figure>
<span id="more"></span>

<h3 id="目录处理命令"><a href="#目录处理命令" class="headerlink" title="目录处理命令"></a>目录处理命令</h3><h4 id="mkdir"><a href="#mkdir" class="headerlink" title="mkdir"></a>mkdir</h4><p>创建新目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">mkdir</span> -p /tmp/forJob/linux 递归创建目录</span><br></pre></td></tr></table></figure>

<h4 id="cd"><a href="#cd" class="headerlink" title="cd"></a>cd</h4><p>切换当前目录</p>
<h4 id="pwd"><a href="#pwd" class="headerlink" title="pwd"></a>pwd</h4><p>显示完整路径</p>
<h4 id="rmdir"><a href="#rmdir" class="headerlink" title="rmdir"></a>rmdir</h4><p>删除<strong>空目录</strong></p>
<h4 id="cp"><a href="#cp" class="headerlink" title="cp"></a>cp</h4><p>文件复制命令</p>
<p>语法：cp [选项] 源文件路径 目标路径</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cp</span> -rp /tmp/forJob/linux /home/jsgo002/Documents  <span class="comment"># 将目标目录复制到指定位置</span></span><br><span class="line">-r 删除目录文件</span><br><span class="line">-p 复制文件保留源文件信息</span><br><span class="line"><span class="built_in">cp</span> -r /tmp/forJob/linux /home/jsgo002/Documents/changename <span class="comment">#复制并修改名称，linux-&gt;changename</span></span><br></pre></td></tr></table></figure>

<h4 id="mv"><a href="#mv" class="headerlink" title="mv"></a>mv</h4><p>文件移动、剪切</p>
<h4 id="rm"><a href="#rm" class="headerlink" title="rm"></a>rm</h4><p>文件删除</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">rm</span> -rf /tmp/forJob/linux</span><br><span class="line">-r 删除目录文件</span><br><span class="line">-f 强制删除文件</span><br></pre></td></tr></table></figure>

<h3 id="文件处理命令"><a href="#文件处理命令" class="headerlink" title="文件处理命令"></a>文件处理命令</h3><h4 id="touch"><a href="#touch" class="headerlink" title="touch"></a>touch</h4><p>创建空文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /home/jsgo002/Documents/linux</span><br><span class="line"><span class="built_in">touch</span> linuxcmd.md</span><br><span class="line"><span class="built_in">touch</span> linux1 linux2  <span class="comment"># 同时创建两个文件</span></span><br></pre></td></tr></table></figure>

<h4 id="cat"><a href="#cat" class="headerlink" title="cat"></a>cat</h4><p>显示文件内容</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cat</span> /etc/issue</span><br><span class="line"><span class="built_in">cat</span> -n /etc/services</span><br><span class="line">-n 显示行号</span><br></pre></td></tr></table></figure>

<h4 id="more-less"><a href="#more-less" class="headerlink" title="more/less"></a>more/less</h4><p>分页显示文件内容</p>
<h4 id="head"><a href="#head" class="headerlink" title="head"></a>head</h4><p>显示文件前几行信息</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">head</span> -n 20 /etc/services</span><br><span class="line">-n 指定行数</span><br><span class="line">20 行数值，默认10</span><br></pre></td></tr></table></figure>

<h4 id="tail"><a href="#tail" class="headerlink" title="tail"></a>tail</h4><p>显示文件后几行信息</p>
<h4 id="ln"><a href="#ln" class="headerlink" title="ln"></a>ln</h4><p>生成链接文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">ln</span> -s /etc/issue /tmp/issue.s   <span class="comment"># 生成软链接（指向文件索引地址）</span></span><br><span class="line"><span class="built_in">ln</span> /etc/issue /tmp/issue.h      <span class="comment"># 生成硬链接（指向文件内存地址）</span></span><br></pre></td></tr></table></figure>

<h3 id="chmod"><a href="#chmod" class="headerlink" title="chmod"></a>chmod</h3><p>改变文件或目录权限</p>
<p>语法：chmod [{ugoa}{+-=}{rwx}] [文件或目录] [mode=421] [文件或目录]</p>
<p>-R 递归修改</p>
<p>权限数字：r–4;w–2;x–1。(rwxrw-r–对应764)</p>
<p><strong>注：对文件删除的权限，是该文件所在目录有<code>w</code>权限。</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">chmod</span> g-w,o+w linuxcmd.md</span><br><span class="line"><span class="built_in">chmod</span> o=r linuxcmd.md</span><br><span class="line"><span class="built_in">chmod</span> 664 linuxcmd.md</span><br></pre></td></tr></table></figure>

<h4 id="chown"><a href="#chown" class="headerlink" title="chown"></a>chown</h4><p>改变文件或目录的所有者（只有root管理员有权限修改）</p>
<p>语法：chown [用户] [文件或目录]</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo useradd jsgo</span><br><span class="line">sudo <span class="built_in">chown</span> jsgo linuxcmd.md</span><br></pre></td></tr></table></figure>

<h4 id="chgrp"><a href="#chgrp" class="headerlink" title="chgrp"></a>chgrp</h4><p>改变文件或目录的所属组</p>
<p>语法：chgrp [用户组] [文件或目录]</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo groupadd jsgos </span><br><span class="line">sudo <span class="built_in">chgrp</span> jsgos linuxcmd.md</span><br></pre></td></tr></table></figure>

<h4 id="umask"><a href="#umask" class="headerlink" title="umask"></a>umask</h4><p>显示、设置文件的缺省权限</p>
<p>语法：umask [-S]</p>
<p>-S 以rwx形式显示新建文件缺省权限</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">umask</span></span><br><span class="line"><span class="comment"># 0002 第一位0为特殊权限，后三位为文件权限标记，其与777对应的权限做异或即为对应权限。</span></span><br><span class="line"><span class="built_in">umask</span> -S</span><br><span class="line"><span class="comment"># u=rwx,g=rwx,o=rx</span></span><br><span class="line"><span class="built_in">umask</span> 056   <span class="comment"># 更改权限</span></span><br><span class="line"><span class="comment"># u=rwx,g=w,o=x</span></span><br></pre></td></tr></table></figure>

<h3 id="关机重启命令"><a href="#关机重启命令" class="headerlink" title="关机重启命令"></a>关机重启命令</h3><h4 id="shutdown"><a href="#shutdown" class="headerlink" title="shutdown"></a>shutdown</h4><p>语法：shutdown [选项] 时间</p>
<p>-c：取消前一个关机命令</p>
<p>-h：关机</p>
<p>-r：重启</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">shutdown -r now</span><br></pre></td></tr></table></figure>

<p>其他关机命令：<code>halt</code>,<code>poweroff</code>,<code>init 0</code></p>
<p>其他重启命令：<code>reboot</code>,<code>init 6</code></p>
<p><strong><code>init</code>命令，系统运行级别：</strong></p>
<p>0–关机；1–单用户；2–不完全多用户，不含NFS服务；3–完全多用户；4–未分配；</p>
<p>5–图形界面；6–重启</p>
<p><code>cat \etc\inittab</code> 查看上述运行级别描述（注：ubantu9.10后版本无此配置文件）</p>
<h4 id="runlevel"><a href="#runlevel" class="headerlink" title="runlevel"></a>runlevel</h4><p>查看系统运行级别（# N 5）</p>
<h4 id="logout"><a href="#logout" class="headerlink" title="logout"></a>logout</h4><p>让用户退出系统</p>
<h3 id="文件搜索命令"><a href="#文件搜索命令" class="headerlink" title="文件搜索命令"></a>文件搜索命令</h3><h4 id="find"><a href="#find" class="headerlink" title="find"></a>find</h4><p>语法：find [搜索范围] [匹配调节]</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">find /etc -name init <span class="comment"># 在/etc中查找文件init</span></span><br><span class="line">find /etc -name *init??? <span class="comment"># *匹配任意字符，?匹配单个字符</span></span><br><span class="line"><span class="comment"># -iname 搜索时不区分大小写，-name区分</span></span><br><span class="line">find / -size +204800  <span class="comment">#在根目录下查找大于100MB的文件，单位：数据块，1数据块=0.5k</span></span><br><span class="line"><span class="comment"># +n大于；-n小于；n等于</span></span><br><span class="line">find /home -user jsgo</span><br><span class="line"><span class="comment"># -user根据所有者查找；-group根据所属组查找</span></span><br><span class="line">find /etc -cmin -5  <span class="comment">#查找5分钟内被修改过的文件</span></span><br><span class="line">find /etc -size +163840 -a -size -204800 <span class="comment">#查找大于80MB小于100MB的文件</span></span><br><span class="line"><span class="comment"># -a条件和；-o条件或</span></span><br><span class="line">find /etc -name init -<span class="built_in">exec</span> <span class="built_in">ls</span> -l &#123;&#125;\  <span class="comment">#c查找init文件并显示其详细信息</span></span><br><span class="line"><span class="comment"># -exec/-ok 命令 ｛｝\ 对搜索结果执行操作</span></span><br><span class="line"><span class="comment">################</span></span><br><span class="line"><span class="comment"># -type 根据文件类型查找（f文件 d目录 l软链接文件）</span></span><br><span class="line"><span class="comment"># -inum 根据i节点查找</span></span><br></pre></td></tr></table></figure>

<h4 id="locate-updatedb"><a href="#locate-updatedb" class="headerlink" title="locate/updatedb"></a>locate/updatedb</h4><p>在文件资料库中查找文件/更新locate文件资料库</p>
<p>语法：locate 文件名</p>
<p>-i 不区分大小写搜索</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install mlocate <span class="comment"># ubantu系统默认没有安装locate命令</span></span><br><span class="line">locate linuxcmd.md</span><br></pre></td></tr></table></figure>

<h4 id="which"><a href="#which" class="headerlink" title="which"></a>which</h4><p>搜索<strong>命令</strong>所在的目录及别名信息</p>
<p>语法：which [命令名称]</p>
<h4 id="whereis"><a href="#whereis" class="headerlink" title="whereis"></a>whereis</h4><p>搜索命令所在目录及帮助文档路径</p>
<h4 id="grep"><a href="#grep" class="headerlink" title="grep"></a>grep</h4><p>在文件中搜寻字符串匹配的行并输出</p>
<p>-i 不区分大小写</p>
<p>-v 排除指定字符串</p>
<p>语法: grep -iv [指定字符串] [文件]</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">grep -v ^<span class="comment"># /etc/init  # 查找非#开头的文件中信息</span></span><br><span class="line">grep -i multiuser /etc/init <span class="comment"># 不区分大小写寻找multiuser所在行信息</span></span><br></pre></td></tr></table></figure>
<h3 id="帮助命令"><a href="#帮助命令" class="headerlink" title="帮助命令"></a>帮助命令</h3><h4 id="man"><a href="#man" class="headerlink" title="man"></a>man</h4><p>获取[命令或配置文件]的帮助信息（manual）</p>
<p>语法：man [命令或配置文件]</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">man passwd   <span class="comment"># 查看passwd指令信息</span></span><br><span class="line">man 5 passwd <span class="comment"># 查看passwd的配置信息</span></span><br></pre></td></tr></table></figure>

<h4 id="whatis"><a href="#whatis" class="headerlink" title="whatis"></a>whatis</h4><p>查看命令的功能描述信息</p>
<p>语法：whatis [命令]</p>
<h4 id="apropos"><a href="#apropos" class="headerlink" title="apropos"></a>apropos</h4><p>查看配置文件的功能描述信息</p>
<h4 id="–help"><a href="#–help" class="headerlink" title="–help"></a>–help</h4><p>列出命令选项</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">man --<span class="built_in">help</span></span><br></pre></td></tr></table></figure>

<h4 id="info"><a href="#info" class="headerlink" title="info"></a>info</h4><p>查看命令、文件的信息</p>
<h4 id="help"><a href="#help" class="headerlink" title="help"></a>help</h4><p>查看内置命令的帮助信息</p>
<h3 id="用户管理"><a href="#用户管理" class="headerlink" title="用户管理"></a>用户管理</h3><h4 id="useradd"><a href="#useradd" class="headerlink" title="useradd"></a>useradd</h4><p>添加用户</p>
<h4 id="passwd"><a href="#passwd" class="headerlink" title="passwd"></a>passwd</h4><p>修改用户密码</p>
<h4 id="w"><a href="#w" class="headerlink" title="w"></a>w</h4><p>查看系统登陆用户的登陆信息</p>
<h3 id="文件压缩"><a href="#文件压缩" class="headerlink" title="文件压缩"></a>文件压缩</h3><p>压缩格式:<code>.gz;.zip;.rar</code></p>
<h4 id="gzip"><a href="#gzip" class="headerlink" title="gzip"></a>gzip</h4><p>压缩文件，压缩后格式为<code>.gz</code>；gzip不能压缩目录，且压缩的文件会被删除</p>
<p>语法：gzip [文件]</p>
<h4 id="gunzip"><a href="#gunzip" class="headerlink" title="gunzip"></a>gunzip</h4><p>解压缩<code>.gz</code>的压缩文件</p>
<p>语法：gunzip [压缩文件]</p>
<h4 id="tar"><a href="#tar" class="headerlink" title="tar"></a>tar</h4><ol>
<li>打包目录，压缩后格式<code>.tar.gz</code></li>
</ol>
<p>语法：tar 选项[-zcf] [压缩后文件名] [目录]</p>
<p>-c 打包</p>
<p>-v 显示详细信息</p>
<p>-f 指定文件名</p>
<p>-z 打包同时压缩</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -zcf etc.tar.gz /etc <span class="comment"># 将etc目录打包并压缩为`.tar.gz`文件</span></span><br></pre></td></tr></table></figure>

<ol start="2">
<li>文件解包</li>
</ol>
<p>-x 解包<br>-z 解压缩<br>-v 显示详细信息<br>-指定解压文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">tar -zxvf etc.tar.gz</span><br></pre></td></tr></table></figure>

<h4 id="zip"><a href="#zip" class="headerlink" title="zip"></a>zip</h4><p>压缩文件或目录，压缩后格式<code>.zip</code></p>
<p>语法：zip 选项[-r] [压缩后文件名] [文件或目录]</p>
<p>-r 压缩目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">zip -r etc.zip /etc</span><br></pre></td></tr></table></figure>

<h4 id="unzip"><a href="#unzip" class="headerlink" title="unzip"></a>unzip</h4><p>解压缩<code>.zip</code>；不保留源文件</p>
<p>语法：unzip [压缩文件]</p>
<h4 id="bzip2"><a href="#bzip2" class="headerlink" title="bzip2"></a>bzip2</h4><p>压缩文件，压缩后格式<code>.bz2</code>；可保留源文件，压缩比高，不可压缩目录（用tar压缩目录，参考gzip）</p>
<p>语法：bzip 选项 [-k] [文件]</p>
<p>-k 压缩后保留源文件</p>
<h4 id="bunzip2"><a href="#bunzip2" class="headerlink" title="bunzip2"></a>bunzip2</h4><p>解压缩</p>
<h3 id="网络命令"><a href="#网络命令" class="headerlink" title="网络命令"></a>网络命令</h3><h4 id="write"><a href="#write" class="headerlink" title="write"></a>write</h4><p>给在线用户发信息，以<code>Ctrl+D</code>保存结束</p>
<p>语法：write &lt;用户名&gt;</p>
<h4 id="wall"><a href="#wall" class="headerlink" title="wall"></a>wall</h4><p>给所有在线用户发送信息（发广播信息）</p>
<p>语法：wall [message]</p>
<h4 id="ping"><a href="#ping" class="headerlink" title="ping"></a>ping</h4><p>测试网络连通性</p>
<p>语法：ping 选项 IP地址</p>
<p>-c 指定发送次数</p>
<h4 id="ifconfig"><a href="#ifconfig" class="headerlink" title="ifconfig"></a>ifconfig</h4><p>查看、设置网卡信息 (interface configure)</p>
<p>语法：ifconfig 网卡名称 IP地址</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">ifconfig <span class="comment"># 查看网卡信息</span></span><br><span class="line">ifcondfig eth33 192.168.234.127  <span class="comment"># 设置网卡信息</span></span><br></pre></td></tr></table></figure>

<h4 id="last"><a href="#last" class="headerlink" title="last"></a>last</h4><p>列出目前与过去登陆系统的用户信息</p>
<h4 id="traceroute"><a href="#traceroute" class="headerlink" title="traceroute"></a>traceroute</h4><p>显示数据包到主机间的路径</p>
<p>语法：traceroute [访问站点]</p>
<h4 id="netstat"><a href="#netstat" class="headerlink" title="netstat"></a>netstat</h4><p>显示网络相关信息</p>
<p>语法：netstat [选项]</p>
<p>-t：TCP协议</p>
<p>-u：UDP协议</p>
<p>-l：监听</p>
<p>-r：路由</p>
<p>-n： 显示IP地址和端口号</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">netstat -tlun  <span class="comment"># 查看本机监听的端口</span></span><br><span class="line">netstat -an    <span class="comment"># 查看本机所有网络连接</span></span><br><span class="line">netstat -rn    <span class="comment"># 查看本机路由表</span></span><br></pre></td></tr></table></figure>

<h4 id="mount"><a href="#mount" class="headerlink" title="mount"></a>mount</h4><p><font color=red>挂载命令</font></p>
<p>语法：mount [-t 文件系统] 设备文件名 挂载点</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mount -t iso9660 /dev/sr0 /mnt/cdrom</span><br></pre></td></tr></table></figure>

<h4 id="umount"><a href="#umount" class="headerlink" title="umount"></a>umount</h4><p>设备卸载</p>
<h3 id="文本编辑器（vim）"><a href="#文本编辑器（vim）" class="headerlink" title="文本编辑器（vim）"></a>文本编辑器（vim）</h3><blockquote>
<p><strong>1.模式转化</strong></p>
<p>正常–&gt;输入：以下这几个参数实现的功能都是转为输入模式，只不过转换后的光标所在的位置不同<br><strong>i：</strong>在当前光标所在字符的前面，转为输入模式；<br><strong>a：</strong>在当前光标所在字符的后面，转为输入模式；<br>**o: **在当前光标所在行的下方，新建一行，并转为输入模式；<br><strong>I：</strong>在当前光标所在行的行首，转为输入模式；<br><strong>A：</strong>在当前光标所在行的行尾，转为输入模式；<br><strong>O：</strong>在当前光标所在行的上方，新建一行，并转为输入模式；</p>
<p><strong>2.关闭文件</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">:q          退出；</span><br><span class="line">:q!         不保存退出；</span><br><span class="line">:w          保存；</span><br><span class="line">:w!         强行保存；</span><br><span class="line">:wq        保存退出</span><br><span class="line">:wq!       强制保存并退出</span><br></pre></td></tr></table></figure>
<p><strong>3.移动光标</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">h:   左；</span><br><span class="line">l:    右；</span><br><span class="line">j:    下；</span><br><span class="line">k:   上；</span><br><span class="line">#h:  移动#个**字符**（#为数字）</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">w:   移至下一个单词的词首；</span><br><span class="line">e:     跳至当前或下一个单词的词尾；</span><br><span class="line">b:     跳至当前或前一个单词的词首；</span><br><span class="line">#w:   移动#个单词</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">0:   绝对行首；</span><br><span class="line">^:   行首的第一个非空白字符；</span><br><span class="line">$:   绝对行尾</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">#G：跳转至第#行；</span><br><span class="line">gg:   第一行；</span><br><span class="line">G：最后一行</span><br></pre></td></tr></table></figure>
<p><strong>4.复制字符</strong> </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">yy：  复制当前行</span><br><span class="line">nyy：复制当前行至下面的n行</span><br></pre></td></tr></table></figure>
<p><strong>5.粘贴</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">p：粘贴到光标的后面</span><br><span class="line">P：粘贴到光标的前面</span><br></pre></td></tr></table></figure>

<p><strong>6.删除字符</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">x: 		 删除光标所在处的单个字符；</span><br><span class="line">#x: 	   删除光标所在处及向后的共#个字符；</span><br><span class="line">d$或D: 从当前光标处删除至行尾；</span><br><span class="line">d^:		从当前光标处删除之行首；</span><br><span class="line">dd: 	   删除当前光标所在行；</span><br><span class="line">#dd: 	删除包括当前光标所在行在内的#行；</span><br></pre></td></tr></table></figure>
<p><strong>7.替换字符</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">r： 替换单个字符（按完r在按你要替换的字符）</span><br><span class="line">R：替换多个字符</span><br></pre></td></tr></table></figure>

<p><strong>8.撤销</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">u：   撤消前一次的编辑操作；</span><br><span class="line">#u：直接撤消最近#次编辑操作；</span><br><span class="line">注：连续u命令可撤消此前的n次编辑操作；vi编辑器无法连续u操作</span><br></pre></td></tr></table></figure>

<p><strong>9.引入外部文件内容</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">：r   /home/jsgo002/Documents/linux/qoute.txt ：填充到当前文件所在光标的后面</span><br></pre></td></tr></table></figure>

<p><strong>10.其他</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">：set    nu            //显示行号</span><br><span class="line">：set    number    //显示行号</span><br><span class="line">：set    nonu        //取消行号显示</span><br><span class="line"></span><br><span class="line">：syntax    on    //开启语法高亮</span><br><span class="line">：syntax    off    //关闭语法高亮</span><br></pre></td></tr></table></figure>

<p><strong>11.自定义功能</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">:map  快捷键触发命令，</span><br><span class="line">例）:map ^P I#&lt;ESC&gt;连续行注释</span><br><span class="line"></span><br><span class="line">例）:n1,n2s/^/#/    (n1,n2为行数；n1-n2行行首替换为#)</span><br><span class="line">:n1,n2s/#//   (n1-n2行#替换为空)</span><br><span class="line"></span><br><span class="line">例）:ab mymail bgape002@163.com  (类似变量替换)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">注：map和ab命令在系统重启后会被清空，可通过编辑用户目录下的`.vimrc`去保留设置。文件位置`/home/username/.vimrc`，`/root/.vimrc`。</span><br></pre></td></tr></table></figure>
</blockquote>
<h3 id="软件包管理"><a href="#软件包管理" class="headerlink" title="软件包管理"></a>软件包管理</h3><h4 id="RPM包命名规则"><a href="#RPM包命名规则" class="headerlink" title="RPM包命名规则"></a>RPM包命名规则</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">httpd-2.2.15.el6.centos.1.i686.rpm</span><br><span class="line"><span class="comment"># httpd 软件包名；2.2.15 软件版本；15 软件发布的次数；el6.centos 适合的linux系统；i686 适合的硬件平台；rpm rpm包扩展名</span></span><br></pre></td></tr></table></figure>

<h4 id="rpm"><a href="#rpm" class="headerlink" title="rpm"></a>rpm</h4><p>-i   安装</p>
<p>-v  显示详细信息</p>
<p>-h  显示进度</p>
<p>-U  升级</p>
<p>-e   卸载</p>
<p>–nodeps  不检测依赖性、</p>
<p>-q（query）  查询</p>
<hr>
<p>rpm包安装   语法：rpm -ivh 包全名</p>
<p>rpm包升级   语法：rpm -Uvh 包全名</p>
<p>rpm包卸载   语法：rpm -e 包名</p>
<p>rpm包查询   语法：rpm -q 包名</p>
<h4 id="apt-ubantu-debian"><a href="#apt-ubantu-debian" class="headerlink" title="apt(ubantu/debian)"></a>apt(ubantu/debian)</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt [options] [command] [package ...]</span><br></pre></td></tr></table></figure>

<ul>
<li><p><strong>options：</strong>可选，选项包括 -h（帮助），-y（当安装过程提示选择全部为”yes”），-q（不显示安装的过程）等等。</p>
</li>
<li><p><strong>command：</strong>要进行的操作。</p>
</li>
<li><p><strong>package</strong>：安装的包名。</p>
</li>
</ul>
<hr>
<p> <strong>apt 常用命令</strong></p>
<ul>
<li><p>列出所有可更新的软件清单命令：<strong>sudo apt update</strong></p>
</li>
<li><p>升级软件包：<strong>sudo apt upgrade</strong></p>
<p>列出可更新的软件包及版本信息：<strong>apt list –upgradeable</strong></p>
<p>升级软件包，升级前先删除需要更新软件包：<strong>sudo apt full-upgrade</strong></p>
</li>
<li><p>安装指定的软件命令：<strong>sudo apt install <package_name></strong></p>
<p>安装多个软件包：<strong>sudo apt install <package_1> <package_2> <package_3></strong></p>
</li>
<li><p>更新指定的软件命令：<strong>sudo apt update <package_name></strong></p>
</li>
<li><p>显示软件包具体信息,例如：版本号，安装大小，依赖关系等等：<strong>sudo apt show <package_name></strong></p>
</li>
<li><p>删除软件包命令：<strong>sudo apt remove <package_name></strong></p>
</li>
<li><p>清理不再使用的依赖和库文件: <strong>sudo apt autoremove</strong></p>
</li>
<li><p>移除软件包及配置文件: <strong>sudo apt purge <package_name></strong></p>
</li>
<li><p>查找软件包命令： <strong>sudo apt search <keyword></strong></p>
</li>
<li><p>列出所有已安装的包：<strong>apt list –installed</strong></p>
</li>
<li><p>列出所有已安装的包的版本信息：<strong>apt list –all-versions</strong></p>
</li>
</ul>
<h3 id="用户与用户组管理"><a href="#用户与用户组管理" class="headerlink" title="用户与用户组管理"></a>用户与用户组管理</h3><h3 id="权限管理"><a href="#权限管理" class="headerlink" title="权限管理"></a>权限管理</h3><ul>
<li><strong>修改文件或目录权限的命令–<code>chmod</code></strong></li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># u所有者；g所在组；o其他人；a所有人</span></span><br><span class="line">1) <span class="built_in">chmod</span> u=rwx,g=rx,o=x 文件/目录名</span><br><span class="line">2) <span class="built_in">chmod</span> o+w 文件/目录名</span><br><span class="line">3) <span class="built_in">chmod</span> a-w 文件/目录名</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">chown</span> [newowner/newgroup] 文件/目录名  <span class="comment">#修改所有者/所在组</span></span><br><span class="line"><span class="built_in">chgrp</span> [newgroup] 文件/目录名  <span class="comment">#修改所在组</span></span><br><span class="line">-R 递归操作，修改目录下的所有文件</span><br></pre></td></tr></table></figure>

<h3 id="任务调度"><a href="#任务调度" class="headerlink" title="任务调度"></a>任务调度</h3><ul>
<li>crontab 进行定时任务设置</li>
</ul>
<ul>
<li>调度任务是指系统在某个时间执行特点的待定命令或程序。</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">crontab [-u user] file</span><br><span class="line">crontab [-u user] &#123;-l | -r | -e&#125;</span><br><span class="line"><span class="comment"># crontab 是用来让使用者在固定时间或固定间隔执行程序之用，换句话说，也就是类似使用者的时程表。</span></span><br><span class="line"><span class="comment"># -u user 是指设定指定 user 的时程表，这个前提是你必须要有其权限(比如说是 root)才能够指定他人的时程表。如果不使用 -u user 的话，就是表示设定自己的时程表。</span></span><br><span class="line">-e 编辑crontab定时任务</span><br><span class="line">-l 查询crontab任务</span><br><span class="line">-r 删除当前用户所有的crontab任务</span><br></pre></td></tr></table></figure>

<p><strong>时间格式：</strong><br><strong><code>f1 f2 f3 f4 f5 program</code></strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">*    *    *    *    *</span><br><span class="line">-    -    -    -    -</span><br><span class="line">|    |    |    |    |</span><br><span class="line">|    |    |    |    +----- 星期中星期几 (0 - 6) (星期天 为0)</span><br><span class="line">|    |    |    +---------- 月份 (1 - 12) </span><br><span class="line">|    |    +--------------- 一个月中的第几天 (1 - 31)</span><br><span class="line">|    +-------------------- 小时 (0 - 23)</span><br><span class="line">+------------------------- 分钟 (0 - 59)</span><br></pre></td></tr></table></figure>

<p>使用者也可以将所有的设定先存放在文件中，用 crontab file 的方式来设定执行时间。</p>
<ul>
<li>每月1号和15号检查<code>/home</code>磁盘 （<code>0 0 1,15 * * fsck /home</code>）</li>
<li>12月的每天6点到12点，每隔3小时执行（<code>0 6-12/3 * 12 * /usr/bin/backup</code>）</li>
</ul>
<hr>
<ul>
<li><strong>at命令：一次性定时计划任务</strong>-</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#格式</span></span><br><span class="line">at[opt][time]</span><br><span class="line">opt：</span><br><span class="line">-m 当指定的任务被完成之后，将给用户发送邮件，即使没有标准输出</span><br><span class="line">-I atq的别名</span><br><span class="line">-d atrm的别名</span><br><span class="line">-v 显示任务将被执行的时间</span><br><span class="line">-c 打印任务的内容到标准输出</span><br><span class="line">-V 显示版本信息</span><br><span class="line">-q&lt;列队&gt; 使用指定的列队</span><br><span class="line">-f&lt;文件&gt; 从指定文件读入任务而不是从标准输入读入</span><br><span class="line">-t&lt;时间参数&gt; 以时间参数的形式提交要运行的任务</span><br><span class="line">time(时间格式)：</span><br><span class="line">HH:MM </span><br><span class="line">ex&gt; 04:00 在今日的 HH:MM 时刻进行，若该时刻已超过，则明天的 HH:MM 进行此任务。</span><br><span class="line">HH:MM YYYY-MM-DD </span><br><span class="line">ex&gt; 04:00 2009-03-17 强制规定在某年某月的某一天的特殊时刻进行该项任务</span><br><span class="line">HH:MM[am|pm] [Month] [Date] </span><br><span class="line">ex&gt; 04pm March 17 也是一样，强制在某年某月某日的某时刻进行该项任务</span><br><span class="line">HH:MM[am|pm] + number [minutes|hours|days|weeks] </span><br><span class="line">ex&gt; now + 5 minutes / ex&gt; 04pm + 3 days  在某个时间点再加几个时间后才进行该项任务。</span><br><span class="line"><span class="comment"># 查看at队列--atq</span></span><br><span class="line"><span class="comment"># 删除队列中的任务--atrm [编号]</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<ul>
<li><code>ps -ef | grep atd</code>查看atd进程是否开启</li>
<li><code>at now + 2 minutes (enter) cal &gt; /hmoe/jsgo002/Documents/linux/cal21 (C+d)</code>2分钟后将日历输入到文件</li>
</ul>
<h3 id="磁盘挂载"><a href="#磁盘挂载" class="headerlink" title="磁盘挂载"></a>磁盘挂载</h3><ul>
<li><p>查看当前磁盘分区情况–<code>lsblk</code></p>
</li>
<li><p>磁盘挂载</p>
<ol>
<li><p>向设备中添加硬盘。（虚拟机菜单中设置内可调整）</p>
</li>
<li><p>分区命令 <code>fdisk /dev/sdb</code>||开始分区后输入n，新增分区，然后选择p，分区类型为主分区。两次回车默认剩余全部空间。最后，w写入分区并退出，q不保存直接退出。</p>
</li>
<li><p>格式化磁盘<code>mkfs -t ext4 .dev/sdb1</code> （ext4是分区类型）</p>
</li>
<li><p>挂载到目录<code>mount /dev/sdb1 /newdisk</code>||磁盘卸载 <code>umount /newdisk or /dev/sdb1</code></p>
</li>
<li><p>注：以上的命令行挂载，重启系统后会失效。永久挂载可统过修改<code>/etc/fstab</code>文件实现，添加完成后，执行<code>mount -a</code>生效挂载。 </p>
</li>
</ol>
</li>
<li><p><code>df -h</code>查看磁盘使用情况</p>
</li>
<li><p><code>du -h</code>查看当前目录的磁盘占用情况</p>
</li>
<li><p>```bash</p>
<h1 id="统计文件夹下文件的个数"><a href="#统计文件夹下文件的个数" class="headerlink" title="统计文件夹下文件的个数"></a>统计文件夹下文件的个数</h1><p>ls -l /opt | grep “^_” | wc -l<br>wc 默认显示统计文件的行数、字数、字节数（-l-w-c）<br>grep 用于查找文件里符合条件的字符串</p>
<h1 id="统计文件夹下目录的个数"><a href="#统计文件夹下目录的个数" class="headerlink" title="统计文件夹下目录的个数"></a>统计文件夹下目录的个数</h1><p>ls -l /opt | grep “^d” | wc -l</p>
<h1 id="统计文件夹下文件的个数，包括子文件夹"><a href="#统计文件夹下文件的个数，包括子文件夹" class="headerlink" title="统计文件夹下文件的个数，包括子文件夹"></a>统计文件夹下文件的个数，包括子文件夹</h1><p>ls -lR /opt | grep “^_” | wc -l</p>
<h1 id="统计文件夹下目录的个数，包括子文件夹"><a href="#统计文件夹下目录的个数，包括子文件夹" class="headerlink" title="统计文件夹下目录的个数，包括子文件夹"></a>统计文件夹下目录的个数，包括子文件夹</h1><p>ls -lR /opt | grep “^d” | wc -l</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line">### linux中的`&amp;\&amp;&amp;\|\||`</span><br><span class="line"></span><br><span class="line">&gt; **在linux中，&amp;和&amp;&amp;,|和||介绍如下：**</span><br><span class="line">&gt;</span><br><span class="line">&gt; &amp;  表示任务在后台执行，如要在后台运行redis-server,则有 redis-server &amp;</span><br><span class="line">&gt;</span><br><span class="line">&gt; &amp;&amp; 表示前一条命令执行成功时，才执行后一条命令 ，如 echo &#x27;1‘ &amp;&amp; echo &#x27;2&#x27;   </span><br><span class="line">&gt;</span><br><span class="line">&gt; | 表示管道，上一条命令的输出，作为下一条命令参数，如 echo &#x27;yes&#x27; | wc -l</span><br><span class="line">&gt;</span><br><span class="line">&gt; || 表示上一条命令执行失败后，才执行下一条命令，如 cat nofile || echo &quot;fail&quot;</span><br><span class="line"></span><br><span class="line">### NAT网络配置</span><br><span class="line"></span><br><span class="line">- `ifconfig`查看网络配置</span><br><span class="line"></span><br><span class="line">- 配置ip地址。1）自动获取。每次自动获取的IP地址可能不一致；2）指定IP。编辑文件`vi /etc/sysconfig/network-scripts/ifcfg-ens33`，将IP地址配置成静态地址。（注：ubantu 17.10后采用netplan方式配置文件写在`/etc/netplan/`下）</span><br><span class="line"></span><br><span class="line">  ```bash</span><br><span class="line">  sudo  vi /etc/netplan/00-installer-config.yaml</span><br><span class="line">  # This is the network config written by &#x27;subiquity&#x27;</span><br><span class="line">  network:</span><br><span class="line">    ethernets:</span><br><span class="line">      ens33:</span><br><span class="line">        addresses: [192.168.0.102/24]</span><br><span class="line">        dhcp4: false</span><br><span class="line">        gateway4: 192.168.0.254</span><br><span class="line">   </span><br><span class="line">    version: 2</span><br><span class="line">    ## 配置完成后，执行 sudo  netplan  apply让它生效。</span><br></pre></td></tr></table></figure></li>
<li><p>设置主机名。1）<code>hostname</code>查看主机名；2）修改文件<code>/etc/hostname</code>;修改后，重启生效。</p>
</li>
</ul>
<h3 id="进程"><a href="#进程" class="headerlink" title="进程"></a>进程</h3><ul>
<li><p><code>ps -aux</code>查看当前运行进程的详细信息</p>
<blockquote>
<p>USER：用户名称</p>
<p>PID：进程号</p>
<p>PPID：父进程号</p>
<p>%CPU：进程占用CPU百分比</p>
<p>%MEM：进程占用物理内存百分比</p>
<p>VSZ：进程占用虚拟内存大小</p>
<p>RSS：进程占用物理内存大小</p>
<p>TTY：终端名称</p>
<p>STAT：进程状态。S-睡眠，s-会话先导进程，N-拥有比普通优先级更低的优先级，R-正在运行，D-短期等待，Z-僵死进程，T-被跟踪或被停止</p>
<p>START：进程启动时间</p>
<p>TIME：CPU占用时间</p>
<p>COMMAND：启动进程所用的命令和参数</p>
</blockquote>
</li>
<li><p><code>ps -ef</code>以全格式显示当前所有进程</p>
</li>
<li><p>终止进程。1)<code>kill [opt] 进程号</code>（-9表示强制结束进程）；2)<code>killall 进程名</code></p>
</li>
<li><p>以进程树的形式显示进程<code>pstree [opt]</code>(-p显示进程号，-u显示进程的用户)</p>
</li>
</ul>
<h3 id="监控网络状态"><a href="#监控网络状态" class="headerlink" title="监控网络状态"></a>监控网络状态</h3><ul>
<li><p><code>top [opt]</code></p>
<blockquote>
<p>-d 秒数 | 指定top命令每隔几秒更新。默认3s</p>
<p>-i | 使top不显示任何闲置或僵死进程</p>
<p>-p | 指定监控进程ID来仅仅监控某个进程的状态</p>
</blockquote>
</li>
<li><p>top界面交互操作</p>
<blockquote>
<p>P | 以CPU使用频率排序，默认</p>
<p>M | 以内存使用率排序</p>
<p>N | 以PID排序</p>
<p>q | 退出top</p>
</blockquote>
</li>
<li><p>查看系统网络情况<code>netstat [opt]</code></p>
<blockquote>
<p>-an | 按一定顺序排列输出</p>
<p>-p | 显示哪个进程正在调用</p>
</blockquote>
</li>
</ul>
<h3 id="服务管理"><a href="#服务管理" class="headerlink" title="服务管理"></a>服务管理</h3><ul>
<li><p> 服务本质就是进程，但是是运行在后台的，通常会监听某个端口，等待其他程序的请求，又称守护进程。</p>
</li>
<li><p><code>service 服务名 [start|stop|restart|reload|status];</code>service指令管理的服务在<code>/etc/init.d</code></p>
</li>
<li><p><code>systemctl [start|stop|restart|status] 服务名</code>；<code>systemctl</code>指令管理服务在<code>/usr/lib/systemd/system</code></p>
<blockquote>
<p>systemctl设置服务的自启动状态</p>
<ol>
<li>systemctl list-unit-files [| grep 服务名] ；查看服务开机启动状态</li>
<li>systemctl enable 服务名；设置服务开机启动</li>
<li>systemctl disable 服务名；关闭服务开机启动</li>
<li>systemctl is-enable 服务名；查询某个服务是否是自启动的</li>
</ol>
</blockquote>
</li>
</ul>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><font size=2>

<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_37896194/article/details/80369432">vi与vim的区别以及常用命令</a></p>
<p><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1mW411i7Qf?from=search&seid=3713860225560242086">史上最牛的Linux视频教程—兄弟连</a></p>
<p><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Sv411r7vd?from=search&seid=12012456865973446978">2021韩顺平 一周学会Linux</a></p>
</font>


    </div>

    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/blog/tags/linux%E5%9F%BA%E7%A1%80/" rel="tag"><i class="fa fa-tag"></i> linux基础</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/blog/2021/05/28/leetcode-477-m/" rel="prev" title="leetcode 477 m">
      <i class="fa fa-chevron-left"></i> leetcode 477 m
    </a></div>
      <div class="post-nav-item">
    <a href="/blog/2021/07/28/NLP/" rel="next" title="NLP">
      NLP <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>


        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#linux%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">1.</span> <span class="nav-text">linux常用命令</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#ls"><span class="nav-number">1.1.</span> <span class="nav-text">ls</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%9B%AE%E5%BD%95%E5%A4%84%E7%90%86%E5%91%BD%E4%BB%A4"><span class="nav-number">1.2.</span> <span class="nav-text">目录处理命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#mkdir"><span class="nav-number">1.2.1.</span> <span class="nav-text">mkdir</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#cd"><span class="nav-number">1.2.2.</span> <span class="nav-text">cd</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#pwd"><span class="nav-number">1.2.3.</span> <span class="nav-text">pwd</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#rmdir"><span class="nav-number">1.2.4.</span> <span class="nav-text">rmdir</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#cp"><span class="nav-number">1.2.5.</span> <span class="nav-text">cp</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#mv"><span class="nav-number">1.2.6.</span> <span class="nav-text">mv</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#rm"><span class="nav-number">1.2.7.</span> <span class="nav-text">rm</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%96%87%E4%BB%B6%E5%A4%84%E7%90%86%E5%91%BD%E4%BB%A4"><span class="nav-number">1.3.</span> <span class="nav-text">文件处理命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#touch"><span class="nav-number">1.3.1.</span> <span class="nav-text">touch</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#cat"><span class="nav-number">1.3.2.</span> <span class="nav-text">cat</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#more-less"><span class="nav-number">1.3.3.</span> <span class="nav-text">more&#x2F;less</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#head"><span class="nav-number">1.3.4.</span> <span class="nav-text">head</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#tail"><span class="nav-number">1.3.5.</span> <span class="nav-text">tail</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ln"><span class="nav-number">1.3.6.</span> <span class="nav-text">ln</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#chmod"><span class="nav-number">1.4.</span> <span class="nav-text">chmod</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#chown"><span class="nav-number">1.4.1.</span> <span class="nav-text">chown</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#chgrp"><span class="nav-number">1.4.2.</span> <span class="nav-text">chgrp</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#umask"><span class="nav-number">1.4.3.</span> <span class="nav-text">umask</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%85%B3%E6%9C%BA%E9%87%8D%E5%90%AF%E5%91%BD%E4%BB%A4"><span class="nav-number">1.5.</span> <span class="nav-text">关机重启命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#shutdown"><span class="nav-number">1.5.1.</span> <span class="nav-text">shutdown</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#runlevel"><span class="nav-number">1.5.2.</span> <span class="nav-text">runlevel</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#logout"><span class="nav-number">1.5.3.</span> <span class="nav-text">logout</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%96%87%E4%BB%B6%E6%90%9C%E7%B4%A2%E5%91%BD%E4%BB%A4"><span class="nav-number">1.6.</span> <span class="nav-text">文件搜索命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#find"><span class="nav-number">1.6.1.</span> <span class="nav-text">find</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#locate-updatedb"><span class="nav-number">1.6.2.</span> <span class="nav-text">locate&#x2F;updatedb</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#which"><span class="nav-number">1.6.3.</span> <span class="nav-text">which</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#whereis"><span class="nav-number">1.6.4.</span> <span class="nav-text">whereis</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#grep"><span class="nav-number">1.6.5.</span> <span class="nav-text">grep</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%B8%AE%E5%8A%A9%E5%91%BD%E4%BB%A4"><span class="nav-number">1.7.</span> <span class="nav-text">帮助命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#man"><span class="nav-number">1.7.1.</span> <span class="nav-text">man</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#whatis"><span class="nav-number">1.7.2.</span> <span class="nav-text">whatis</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#apropos"><span class="nav-number">1.7.3.</span> <span class="nav-text">apropos</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%E2%80%93help"><span class="nav-number">1.7.4.</span> <span class="nav-text">–help</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#info"><span class="nav-number">1.7.5.</span> <span class="nav-text">info</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#help"><span class="nav-number">1.7.6.</span> <span class="nav-text">help</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%94%A8%E6%88%B7%E7%AE%A1%E7%90%86"><span class="nav-number">1.8.</span> <span class="nav-text">用户管理</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#useradd"><span class="nav-number">1.8.1.</span> <span class="nav-text">useradd</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#passwd"><span class="nav-number">1.8.2.</span> <span class="nav-text">passwd</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#w"><span class="nav-number">1.8.3.</span> <span class="nav-text">w</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%96%87%E4%BB%B6%E5%8E%8B%E7%BC%A9"><span class="nav-number">1.9.</span> <span class="nav-text">文件压缩</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#gzip"><span class="nav-number">1.9.1.</span> <span class="nav-text">gzip</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#gunzip"><span class="nav-number">1.9.2.</span> <span class="nav-text">gunzip</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#tar"><span class="nav-number">1.9.3.</span> <span class="nav-text">tar</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#zip"><span class="nav-number">1.9.4.</span> <span class="nav-text">zip</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#unzip"><span class="nav-number">1.9.5.</span> <span class="nav-text">unzip</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#bzip2"><span class="nav-number">1.9.6.</span> <span class="nav-text">bzip2</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#bunzip2"><span class="nav-number">1.9.7.</span> <span class="nav-text">bunzip2</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%BD%91%E7%BB%9C%E5%91%BD%E4%BB%A4"><span class="nav-number">1.10.</span> <span class="nav-text">网络命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#write"><span class="nav-number">1.10.1.</span> <span class="nav-text">write</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#wall"><span class="nav-number">1.10.2.</span> <span class="nav-text">wall</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ping"><span class="nav-number">1.10.3.</span> <span class="nav-text">ping</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ifconfig"><span class="nav-number">1.10.4.</span> <span class="nav-text">ifconfig</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#last"><span class="nav-number">1.10.5.</span> <span class="nav-text">last</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#traceroute"><span class="nav-number">1.10.6.</span> <span class="nav-text">traceroute</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#netstat"><span class="nav-number">1.10.7.</span> <span class="nav-text">netstat</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#mount"><span class="nav-number">1.10.8.</span> <span class="nav-text">mount</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#umount"><span class="nav-number">1.10.9.</span> <span class="nav-text">umount</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91%E5%99%A8%EF%BC%88vim%EF%BC%89"><span class="nav-number">1.11.</span> <span class="nav-text">文本编辑器（vim）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%BD%AF%E4%BB%B6%E5%8C%85%E7%AE%A1%E7%90%86"><span class="nav-number">1.12.</span> <span class="nav-text">软件包管理</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#RPM%E5%8C%85%E5%91%BD%E5%90%8D%E8%A7%84%E5%88%99"><span class="nav-number">1.12.1.</span> <span class="nav-text">RPM包命名规则</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#rpm"><span class="nav-number">1.12.2.</span> <span class="nav-text">rpm</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#apt-ubantu-debian"><span class="nav-number">1.12.3.</span> <span class="nav-text">apt(ubantu&#x2F;debian)</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%94%A8%E6%88%B7%E4%B8%8E%E7%94%A8%E6%88%B7%E7%BB%84%E7%AE%A1%E7%90%86"><span class="nav-number">1.13.</span> <span class="nav-text">用户与用户组管理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9D%83%E9%99%90%E7%AE%A1%E7%90%86"><span class="nav-number">1.14.</span> <span class="nav-text">权限管理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BB%BB%E5%8A%A1%E8%B0%83%E5%BA%A6"><span class="nav-number">1.15.</span> <span class="nav-text">任务调度</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%A3%81%E7%9B%98%E6%8C%82%E8%BD%BD"><span class="nav-number">1.16.</span> <span class="nav-text">磁盘挂载</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%BB%9F%E8%AE%A1%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E6%96%87%E4%BB%B6%E7%9A%84%E4%B8%AA%E6%95%B0"><span class="nav-number"></span> <span class="nav-text">统计文件夹下文件的个数</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%BB%9F%E8%AE%A1%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E7%9B%AE%E5%BD%95%E7%9A%84%E4%B8%AA%E6%95%B0"><span class="nav-number"></span> <span class="nav-text">统计文件夹下目录的个数</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%BB%9F%E8%AE%A1%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E6%96%87%E4%BB%B6%E7%9A%84%E4%B8%AA%E6%95%B0%EF%BC%8C%E5%8C%85%E6%8B%AC%E5%AD%90%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="nav-number"></span> <span class="nav-text">统计文件夹下文件的个数，包括子文件夹</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E7%BB%9F%E8%AE%A1%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E7%9B%AE%E5%BD%95%E7%9A%84%E4%B8%AA%E6%95%B0%EF%BC%8C%E5%8C%85%E6%8B%AC%E5%AD%90%E6%96%87%E4%BB%B6%E5%A4%B9"><span class="nav-number"></span> <span class="nav-text">统计文件夹下目录的个数，包括子文件夹</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%BF%9B%E7%A8%8B"><span class="nav-number">0.1.</span> <span class="nav-text">进程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%9B%91%E6%8E%A7%E7%BD%91%E7%BB%9C%E7%8A%B6%E6%80%81"><span class="nav-number">0.2.</span> <span class="nav-text">监控网络状态</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9C%8D%E5%8A%A1%E7%AE%A1%E7%90%86"><span class="nav-number">0.3.</span> <span class="nav-text">服务管理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8F%82%E8%80%83"><span class="nav-number">0.4.</span> <span class="nav-text">参考</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="bgape002"
      src="/blog/images/head.png">
  <p class="site-author-name" itemprop="name">bgape002</p>
  <div class="site-description" itemprop="description">mail: bgape002@163.com</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">61</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/blog/categories/">
          
        <span class="site-state-item-count">27</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/blog/tags/">
          
        <span class="site-state-item-count">66</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 2021 – 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">bgape002</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/pisces.js"></script>


<script src="/blog/js/next-boot.js"></script>




  




  
<script src="/blog/js/local-search.js"></script>











<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'forest',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'szhBf0Qamzsowubi1WnkXmUj-gzGzoHsz',
      appKey     : 'WpwxoK0fVJHvhzWwakr9vbpA',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
